package org.ewaf.framework.util;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;


public class HttpUtil {

	public static HttpServletRequest getRequest(){
		
		
		ActionContext ctx = ActionContext.getContext();
		HttpServletRequest request = (HttpServletRequest) ctx
				.get(ServletActionContext.HTTP_REQUEST);
		
		return request;
	}
	
	
	public static HttpServletResponse getResponse(){
		
		ActionContext ctx = ActionContext.getContext();
		HttpServletResponse response = (HttpServletResponse) ctx
				.get(ServletActionContext.HTTP_RESPONSE);

		
		return response;
	}
	
	public static PrintWriter getPrintWrite() throws IOException {
		return getResponse().getWriter();
	}
	
}
